package com.itheima.demo.controller;

import com.itheima.demo.dto.DemoDTO;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

public class DemoController {

        // http://localhost:8080/demo?username=zhangsan&password=123456&createTime=2024-04-01 10:00:00
        @GetMapping("/demo")
        public String demo(DemoDTO demoDTO){
            return demoDTO.getUsername() + "," + demoDTO.getPassword();
        }
        // http://localhost:8080/demo
        // {username:zhangsan , password:123456}
        @PostMapping("/demo")
        public DemoDTO postDemo(@RequestBody DemoDTO demoDTO){
            return demoDTO;
        }
 }


